/* @flow */

import React, { Component } from 'react';
import {
  View,
  Text,
  StyleSheet,
  FlatList,
  Dimensions,
  ScrollView,
} from 'react-native';
//设备适配
var {height, width} = Dimensions.get('window');
import TextView from './TextView'

export default class LeftListView extends Component {

  static defaultProps = {
    data:[],

  }
  constructor(props){
  	super(props);
  	this.state = {
      refreshing:false,
    };
  }
  componentWillMount() {

  }

  render() {
    return (
      // <ScrollView>
        <View style={[styles.container,this.props.style]}>
          {/* <ScrollView> */}
          {this._creatItemList(this.props.data)}
          {/* </ScrollView> */}
        </View>
      // </ScrollView>
    );
  }

  _creatItemList = (data) => {

    var items = []
    for (var i = 0; i < data.length; i++) {
      var dataItem = data[i]
      items.push(
        <TextView
          key={i}
          text={dataItem}
          textStyle={[{fontSize:12},this.props.textStyle]}
          style={[
            {
              backgroundColor:'rgb(255, 255, 255)',
              width:80,
              height:40,
              borderWidth:1,
              borderColor:'rgb(57, 60, 57)',
              justifyContent:'center',
              alignItems:'center'
            },{marginLeft:0,marginTop:i!=0?-1:0},this.props.itemStyle]}
        ></TextView>
      )
    }
    return items
  }

}

const styles = StyleSheet.create({
  container: {
    flex:1
  },
  flatList:{
    backgroundColor:'white',
    width:80,
    borderWidth:1,
    borderColor:'black'
  },
  listItem:{
    height:40,
    borderWidth:1,
    borderColor:'black',
    justifyContent:'center',
    alignItems:'center',
    // margin:0,
    // marginRight:0,
  },
  listItemText:{
    fontSize:12,
  }

});
